<template>
  <div class="job-card">
    <div class="positionName" @click="handleClick">
      {{ props.info.positionName }}
    </div>
    <div class="tag">
      <div
        class="tag-item"
        v-for="(item, index) in props.info.combinationSubjectList"
        :key="index"
      >
        {{ item.subjectTypeName }}
      </div>
    </div>
    <div class="info">
      <div class="info-item">
        对应学校
        <span>{{ props.info.collegeNum }}所</span>
      </div>
      <div class="info-item">
        平均薪酬
        <span>￥{{ props.info.averageSalary }}</span>
      </div>
      <div class="info-item">
        对应专业 <span>{{ props.info.collegeNum }}个</span>
      </div>
      <div class="info-item">
        招聘热度 <span>{{ props.info.hotNum }} </span>
        <!-- <img class="icon" :src="upArrow" alt="" /> -->
        <img
          class="icon"
          :src="
            props.info.hotTrend == 1
              ? upArrow
              : props.info.hotTrend == 2
              ? downArrow
              : ''
          "
        />
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue';
import { useRouter } from 'vue-router';
import upArrow from '@/assets/images/upArrow.png';
import downArrow from '@/assets/images/downArrow.png';

const props = defineProps({
  info: {
    type: Object,
    default: {},
  },
});

const router = useRouter();

const handleClick = () => {
  router.push({
    path: '/positionDetail',
    query: {
      positionId: props.info.positionId,
    },
  });
};
</script>

<style lang="scss" scoped>
.job-card {
  width: 438px;
  height: 235px;
  background: #ffffff;
  border-radius: 13px;
  border: 2px solid #ebf0f5;
  padding: 24px 26px 28px 24px;
  box-sizing: border-box;
  .positionName {
    font-family: PingFang-SC, PingFang-SC;
    font-weight: bold;
    font-size: 26px;
    color: #222222;
  }
  .tag {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    .tag-item {
      width: 88px;
      height: 35px;
      background: #f1f8f6;
      box-sizing: border-box;
      border-radius: 3px;
      font-family: PingFangSC, PingFang SC;
      font-weight: 400;
      font-size: 22px;
      color: #4fa499;
      display: flex;
      align-items: center;
      justify-content: center;
    }
  }
  .info {
    display: flex;
    flex-wrap: wrap;
    margin-top: 30px;
    gap: 12px;
    .info-item {
      font-family: PingFangSC, PingFang SC;
      font-weight: 400;
      font-size: 20px;
      color: #9cabb7;
      padding-right: 24px;
      span {
        font-family: PingFangSC, PingFang SC;
        font-weight: 400;
        font-size: 20px;
        color: #666666;
      }
      .icon {
        width: 16px;
        height: 16px;
      }
    }
  }
}
</style>
